package com.song.config.redis;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration;

@Configuration
@EnableRedisHttpSession
public class SessionConfig {
    /**
     * 配置会话过期时间（1800秒，30分钟）
     * @return
     */
    @Primary
    @Bean
    public RedisHttpSessionConfiguration redisHttpSessionConfiguration(){
        RedisHttpSessionConfiguration sessionConfiguration = new RedisHttpSessionConfiguration();
        sessionConfiguration.setMaxInactiveIntervalInSeconds(1800);
        return sessionConfiguration;
    }
}
